<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 
        3个可乐瓶可以换一瓶可乐，现在有364瓶可乐。问一共可以喝多少瓶可乐，剩下几个空瓶！
     -->
</head>

<body>

</body>
<script>
    let coke = 364;
    let drink = coke,
        empty = coke;
    while (empty >= 3) {
        drink += parseInt(coke / 3);
        empty = parseInt(empty / 3) + empty % 3;
        // console.log(coke, drink, empty, empty % 3);
    }
    console.log('有 ' + coke + ' 瓶可乐，可以喝 ' + drink + ' 瓶可乐，剩下 ' + empty + ' 个空瓶！');
</script>

</html>